package com.web.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.web.params.ViewnumParams;
import com.web.service.InfoService;

@Aspect
@Component
public class ViewAspect {
	@Autowired
	private InfoService infoService;
	
	@Pointcut("execution(* com.web.controller.HomeController.Detail(..))")
	private void detailPointcut() {}
	
	@Before("detailPointcut()")
	public void detailView(JoinPoint jp) {
		Object[] args = jp.getArgs();
		Integer userId = (Integer) args[0];
		ViewnumParams params = new ViewnumParams(userId,1);
		infoService.watch(params);
		
		
		
		
	}
	

}
